#ifndef ABSTRACT_LAYER_H
#define ABSTRACT_LAYER_H

#include <QtCore/QObject>
#include <QtGui/QKeyEvent>
#include <QtGui/QPainter>

class MapWidget;

class AbstractLayer : public QObject
{
    Q_OBJECT
public:
    AbstractLayer(MapWidget *map);

    virtual void load(const QString &filename);
    virtual void zoom(int level);
    virtual void pan(const QPoint &move);
    virtual void triggerAction();
    virtual void keyPressed(QKeyEvent *event);

    void paintLayer(QPainter *painter);

    bool isVisible() const;

public slots:
    void setVisible(bool visible = true);
    void toggleVisibility();

signals:
    void visibilityChanged(bool visible);

protected:
    MapWidget *map() const;
    virtual void paint(QPainter *painter) = 0;

private:
    MapWidget *m_map;
    bool m_visible;

};

#endif // ABSTRACT_LAYER_H
